Skip to content

[C#] test petstore client with .net10 #23266

Merged
wing328 merged 5 commits intomasterfrom
csharp-text
Mar 16, 2026
Merged

[C#] test petstore client with .net10 #23266
wing328 merged 5 commits intomasterfrom
csharp-text

Conversation

@wing328
Copy link
Copy Markdown
Member

@wing328 wing328 commented Mar 16, 2026

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • File the PR against the correct branch: master (upcoming 7.x.0 minor release - breaking changes with fallbacks), 8.0.x (breaking changes without fallbacks)
  • If your PR solves a reported issue, reference it using GitHub's linking syntax (e.g., having "fixes #123" present in the PR description)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

Summary by cubic

Split the .NET 10 C# restsharp Petstore samples: added a new Petstore sample generated from the localhost test spec and a dedicated EnumMappings sample using the standard Petstore spec to validate enumNameMappings. Also added CI to build the new sample and refreshed generated APIs/docs (base URLs, return types, params, and auth examples).

  • Refactors

    • Generate Petstore at samples/client/petstore/csharp/restsharp/net10/Petstore from ...oneof-primitive-types-localhost.yaml with base http://localhost/v2; generate EnumMappings at .../EnumMappings from petstore.yaml using enumNameMappings (deliveredShipped) with base http://petstore.swagger.io/v2.
    • API updates: PetApi.AddPet now returns Pet; removed UploadFileWithRequiredFile; renamed Store path param order_idorderId; added API key handling on UserApi.CreateUser; pruned test-only endpoints/models and HTTP-signing artifacts in EnumMappings; refreshed openapi.yaml, model descriptions, and READMEs.
  • New Features

    • Add GitHub Actions workflow samples-dotnet-petstore-net10.yml to build and test the Petstore sample on .NET 10.

Written for commit 35fdc30. Summary will update on new commits.

@wing328 wing328 marked this pull request as ready for review March 16, 2026 10:30
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

19 issues found across 416 files

Note: This PR contains a large number of files. cubic only reviews up to 75 files per PR, so some files may not have been reviewed.

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="samples/client/petstore/csharp/restsharp/net10/EnumMappings/docs/Order.md">

<violation number="1" location="samples/client/petstore/csharp/restsharp/net10/EnumMappings/docs/Order.md:2">
P3: Fix the grammar in the generated model description: `a pets` should be singular or rephrased.</violation>
</file>

<file name="samples/client/petstore/csharp/restsharp/net10/Petstore/docs/StoreApi.md">

<violation number="1" location="samples/client/petstore/csharp/restsharp/net10/Petstore/docs/StoreApi.md:259">
P3: The `GetOrderById` parameter description still says "pet" instead of "order", which misdocuments this store endpoint.</violation>
</file>

<file name="samples/client/petstore/csharp/restsharp/net10/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs">

<violation number="1" location="samples/client/petstore/csharp/restsharp/net10/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs:353">
P2: Forward `operationIndex` here; the synchronous wrapper currently ignores the caller's value and always uses the default request operation index.</violation>

<violation number="2" location="samples/client/petstore/csharp/restsharp/net10/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs:493">
P2: Pass `operationIndex` through to `GetInventoryWithHttpInfo`; this wrapper currently ignores the supplied value.</violation>

<violation number="3" location="samples/client/petstore/csharp/restsharp/net10/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs:631">
P2: This wrapper drops `operationIndex`, so synchronous `GetOrderById` calls always use the default request operation index.</violation>

<violation number="4" location="samples/client/petstore/csharp/restsharp/net10/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs:766">
P2: Forward `operationIndex` in `PlaceOrder`; otherwise the synchronous wrapper always falls back to the default operation index.</violation>
</file>

<file name="samples/client/petstore/csharp/restsharp/net10/Petstore/docs/MixedNullableEnumType.md">

<violation number="1" location="samples/client/petstore/csharp/restsharp/net10/Petstore/docs/MixedNullableEnumType.md:3">
P3: Document this enum as enum values instead of an empty model properties table.</violation>
</file>

<file name="samples/client/petstore/csharp/restsharp/net10/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs">

<violation number="1" location="samples/client/petstore/csharp/restsharp/net10/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs:121">
P2: Use `Path.Combine` when writing downloaded stream responses; a custom `TempFolderPath` without a trailing slash produces an invalid file path.</violation>

<violation number="2" location="samples/client/petstore/csharp/restsharp/net10/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs:529">
P2: `ApiResponse.Cookies` is populated twice here, so every response cookie is returned in duplicate.</violation>

<violation number="3" location="samples/client/petstore/csharp/restsharp/net10/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs:576">
P2: Propagate `options.Cookies` in `ExecAsync` as well; async requests currently drop per-request cookies that the sync path sends.</violation>
</file>

<file name="samples/client/petstore/csharp/restsharp/net10/Petstore/docs/UserApi.md">

<violation number="1" location="samples/client/petstore/csharp/restsharp/net10/Petstore/docs/UserApi.md:17">
P2: This `CreateUser` section still says login is required, but the generated client and spec do not apply any authentication to `/user`.</violation>

<violation number="2" location="samples/client/petstore/csharp/restsharp/net10/Petstore/docs/UserApi.md:691">
P3: The `UpdateUser` parameter table describes `username` as a user to delete, which is incorrect for `PUT /user/{username}`.</violation>
</file>

<file name="samples/client/petstore/csharp/restsharp/net10/Petstore/README.md">

<violation number="1" location="samples/client/petstore/csharp/restsharp/net10/Petstore/README.md:18">
P2: The README currently tells users to install a RestSharp version that it also says breaks this client's file-upload APIs.</violation>
</file>

<file name="samples/client/petstore/csharp/restsharp/net10/Petstore/src/Org.OpenAPITools/Api/UserApi.cs">

<violation number="1" location="samples/client/petstore/csharp/restsharp/net10/Petstore/src/Org.OpenAPITools/Api/UserApi.cs:541">
P2: Forward `operationIndex` to the `WithHttpInfo` overload here; as written, the synchronous wrapper ignores the caller-supplied value.</violation>
</file>

<file name="samples/client/petstore/csharp/restsharp/net10/Petstore/src/Org.OpenAPITools/Api/PetApi.cs">

<violation number="1" location="samples/client/petstore/csharp/restsharp/net10/Petstore/src/Org.OpenAPITools/Api/PetApi.cs:1">
P2: Forward `operationIndex` here. As written, the synchronous wrapper ignores the caller's server-selection index and always behaves as if `0` was passed.</violation>
</file>

<file name="samples/client/petstore/csharp/restsharp/net10/Petstore/git_push.sh">

<violation number="1" location="samples/client/petstore/csharp/restsharp/net10/Petstore/git_push.sh:48">
P1: Avoid embedding `$GIT_TOKEN` in the remote URL; this writes the credential into `.git/config` in plain text.</violation>

<violation number="2" location="samples/client/petstore/csharp/restsharp/net10/Petstore/git_push.sh:53">
P2: Don't hardcode `master` here; on fresh repos whose default branch is `main`, this script fails before it can publish anything.</violation>

<violation number="3" location="samples/client/petstore/csharp/restsharp/net10/Petstore/git_push.sh:57">
P1: This pipeline masks `git push` failures, so auth or rejection errors can still leave the script with a successful exit code.</violation>
</file>

<file name="samples/client/petstore/csharp/restsharp/net10/Petstore/docs/PetApi.md">

<violation number="1" location="samples/client/petstore/csharp/restsharp/net10/Petstore/docs/PetApi.md:742">
P3: Fix the duplicated `System.IO.Stream` type markup in the upload parameter tables.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.


# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Mar 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: This pipeline masks git push failures, so auth or rejection errors can still leave the script with a successful exit code.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/csharp/restsharp/net10/Petstore/git_push.sh, line 57:

<comment>This pipeline masks `git push` failures, so auth or rejection errors can still leave the script with a successful exit code.</comment>

<file context>
@@ -0,0 +1,57 @@
+
+# Pushes (Forces) the changes in the local repository up to the remote repository
+echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
+git push origin master 2>&1 | grep -v 'To https'
</file context>
Fix with Cubic

echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Mar 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Avoid embedding $GIT_TOKEN in the remote URL; this writes the credential into .git/config in plain text.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/csharp/restsharp/net10/Petstore/git_push.sh, line 48:

<comment>Avoid embedding `$GIT_TOKEN` in the remote URL; this writes the credential into `.git/config` in plain text.</comment>

<file context>
@@ -0,0 +1,57 @@
+        echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
+        git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
+    else
+        git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
+    fi
+
</file context>
Fix with Cubic

/// <returns>Dictionary&lt;string, int&gt;</returns>
public Dictionary<string, int> GetInventory(int operationIndex = 0)
{
Org.OpenAPITools.Client.ApiResponse<Dictionary<string, int>> localVarResponse = GetInventoryWithHttpInfo();
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Mar 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Pass operationIndex through to GetInventoryWithHttpInfo; this wrapper currently ignores the supplied value.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/csharp/restsharp/net10/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs, line 493:

<comment>Pass `operationIndex` through to `GetInventoryWithHttpInfo`; this wrapper currently ignores the supplied value.</comment>

<file context>
@@ -0,0 +1,907 @@
+        /// <returns>Dictionary&lt;string, int&gt;</returns>
+        public Dictionary<string, int> GetInventory(int operationIndex = 0)
+        {
+            Org.OpenAPITools.Client.ApiResponse<Dictionary<string, int>> localVarResponse = GetInventoryWithHttpInfo();
+            return localVarResponse.Data;
+        }
</file context>
Suggested change
Org.OpenAPITools.Client.ApiResponse<Dictionary<string, int>> localVarResponse = GetInventoryWithHttpInfo();
Org.OpenAPITools.Client.ApiResponse<Dictionary<string, int>> localVarResponse = GetInventoryWithHttpInfo(operationIndex);
Fix with Cubic

/// <returns></returns>
public void DeleteOrder(string orderId, int operationIndex = 0)
{
DeleteOrderWithHttpInfo(orderId);
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Mar 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Forward operationIndex here; the synchronous wrapper currently ignores the caller's value and always uses the default request operation index.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/csharp/restsharp/net10/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs, line 353:

<comment>Forward `operationIndex` here; the synchronous wrapper currently ignores the caller's value and always uses the default request operation index.</comment>

<file context>
@@ -0,0 +1,907 @@
+        /// <returns></returns>
+        public void DeleteOrder(string orderId, int operationIndex = 0)
+        {
+            DeleteOrderWithHttpInfo(orderId);
+        }
+
</file context>
Suggested change
DeleteOrderWithHttpInfo(orderId);
DeleteOrderWithHttpInfo(orderId, operationIndex);
Fix with Cubic

/// <returns>Order</returns>
public Order PlaceOrder(Order order, int operationIndex = 0)
{
Org.OpenAPITools.Client.ApiResponse<Order> localVarResponse = PlaceOrderWithHttpInfo(order);
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Mar 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Forward operationIndex in PlaceOrder; otherwise the synchronous wrapper always falls back to the default operation index.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/csharp/restsharp/net10/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs, line 766:

<comment>Forward `operationIndex` in `PlaceOrder`; otherwise the synchronous wrapper always falls back to the default operation index.</comment>

<file context>
@@ -0,0 +1,907 @@
+        /// <returns>Order</returns>
+        public Order PlaceOrder(Order order, int operationIndex = 0)
+        {
+            Org.OpenAPITools.Client.ApiResponse<Order> localVarResponse = PlaceOrderWithHttpInfo(order);
+            return localVarResponse.Data;
+        }
</file context>
Suggested change
Org.OpenAPITools.Client.ApiResponse<Order> localVarResponse = PlaceOrderWithHttpInfo(order);
Org.OpenAPITools.Client.ApiResponse<Order> localVarResponse = PlaceOrderWithHttpInfo(order, operationIndex);
Fix with Cubic

@@ -1,4 +1,5 @@
# Org.OpenAPITools.Model.Order
An order for a pets from the pet store
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Mar 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: Fix the grammar in the generated model description: a pets should be singular or rephrased.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/csharp/restsharp/net10/EnumMappings/docs/Order.md, line 2:

<comment>Fix the grammar in the generated model description: `a pets` should be singular or rephrased.</comment>

<file context>
@@ -1,4 +1,5 @@
 # Org.OpenAPITools.Model.Order
+An order for a pets from the pet store
 
 ## Properties
</file context>
Suggested change
An order for a pets from the pet store
An order for a pet from the pet store
Fix with Cubic


| Name | Type | Description | Notes |
|------|------|-------------|-------|
| **orderId** | **long** | ID of pet that needs to be fetched | |
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Mar 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The GetOrderById parameter description still says "pet" instead of "order", which misdocuments this store endpoint.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/csharp/restsharp/net10/Petstore/docs/StoreApi.md, line 259:

<comment>The `GetOrderById` parameter description still says "pet" instead of "order", which misdocuments this store endpoint.</comment>

<file context>
@@ -0,0 +1,373 @@
+
+| Name | Type | Description | Notes |
+|------|------|-------------|-------|
+| **orderId** | **long** | ID of pet that needs to be fetched |  |
+
+### Return type
</file context>
Suggested change
| **orderId** | **long** | ID of pet that needs to be fetched | |
| **orderId** | **long** | ID of order that needs to be fetched | |
Fix with Cubic

@@ -0,0 +1,9 @@
# Org.OpenAPITools.Model.MixedNullableEnumType

## Properties
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Mar 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: Document this enum as enum values instead of an empty model properties table.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/csharp/restsharp/net10/Petstore/docs/MixedNullableEnumType.md, line 3:

<comment>Document this enum as enum values instead of an empty model properties table.</comment>

<file context>
@@ -0,0 +1,9 @@
+# Org.OpenAPITools.Model.MixedNullableEnumType
+
+## Properties
+
+Name | Type | Description | Notes
</file context>
Fix with Cubic


| Name | Type | Description | Notes |
|------|------|-------------|-------|
| **username** | **string** | name that need to be deleted | |
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Mar 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The UpdateUser parameter table describes username as a user to delete, which is incorrect for PUT /user/{username}.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/csharp/restsharp/net10/Petstore/docs/UserApi.md, line 691:

<comment>The `UpdateUser` parameter table describes `username` as a user to delete, which is incorrect for `PUT /user/{username}`.</comment>

<file context>
@@ -0,0 +1,715 @@
+
+| Name | Type | Description | Notes |
+|------|------|-------------|-------|
+| **username** | **string** | name that need to be deleted |  |
+| **user** | [**User**](User.md) | Updated user object |  |
+
</file context>
Suggested change
| **username** | **string** | name that need to be deleted | |
| **username** | **string** | name of user to be updated | |
Fix with Cubic

@@ -0,0 +1,860 @@
# Org.OpenAPITools.Api.PetApi
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Mar 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: Fix the duplicated System.IO.Stream type markup in the upload parameter tables.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/csharp/restsharp/net10/Petstore/docs/PetApi.md, line 742:

<comment>Fix the duplicated `System.IO.Stream` type markup in the upload parameter tables.</comment>

<file context>
@@ -0,0 +1,860 @@
+|------|------|-------------|-------|
+| **petId** | **long** | ID of pet to update |  |
+| **additionalMetadata** | **string?** | Additional data to pass to server | [optional]  |
+| **file** | **System.IO.Stream?****System.IO.Stream?** | file to upload | [optional]  |
+
+### Return type
</file context>
Fix with Cubic

@wing328 wing328 merged commit a3e79c8 into master Mar 16, 2026
34 checks passed
@wing328 wing328 deleted the csharp-text branch March 16, 2026 10:52
@wing328 wing328 added this to the 7.21.0 milestone Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant